const WebSocket = require('ws');

const wss = new WebSocket.Server({
    port: 8080
});

wss.on('connection', function connection(ws) {
    // console.log(ws)
    ws.on('message', function incoming(message) {
        try {
            console.log(JSON.parse(message));
        } catch (e) {
            console.log(e)
        }
        // ws.send('something');
    });

    setInterval(() => {
        ws.send(JSON.stringify({
            "addUser": [{ "email": "fada", "uuid": "fadsf" }],
            "delUser": []
        }))
    }, 1000)
});